<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp" %>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>购物车 - 景航电商</title>
		<%@ include file="/common/include/title.jsp" %>
	</head>
	<body>
		<%-- 考虑一下,为啥要使用动态包含 --%>
		<jsp:include page="/header.htm"/>
		<div id="mainBody">
			<div class="container">
				<div class="row">
					<!-- Sidebar ================================================== -->
					<div id="sidebar" class="span3">
						<div class="well well-small">
							<a id="myCart" href="product_summary.html"><img
								src="${rootPath}/themes/images/ico-cart.png" alt="cart">3 Items in your
								cart <span class="badge badge-warning pull-right">$155.00</span></a>
						</div>
						<ul id="sideManu" class="nav nav-tabs nav-stacked">
							<li class="subMenu open"><a> ELECTRONICS [230]</a>
								<ul>
									<li><a class="active" href="products.html"><i
											class="icon-chevron-right"></i>Cameras (100) </a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Computers, Tablets & laptop
											(30)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Mobile Phone (80)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Sound & Vision (15)</a></li>
								</ul></li>
							<li class="subMenu"><a> CLOTHES [840] </a>
								<ul style="display: none">
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Clothing (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Shoes (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Hand Bags (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Men's Clothings (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Men's Shoes (6)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Kids Clothing (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Kids Shoes (3)</a></li>
								</ul></li>
							<li class="subMenu"><a>FOOD AND BEVERAGES [1000]</a>
								<ul style="display: none">
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Angoves (35)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Bouchard Aine & Fils (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>French Rabbit (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Louis Bernard (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>BIB Wine (Bag in Box) (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Other Liquors & Wine (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Garden (3)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Khao Shong (11)</a></li>
								</ul></li>
							<li><a href="products.html">HEALTH & BEAUTY [18]</a></li>
							<li><a href="products.html">SPORTS & LEISURE [58]</a></li>
							<li><a href="products.html">BOOKS & ENTERTAINMENTS [14]</a></li>
						</ul>
						<br />
						<div class="thumbnail">
							<img src="${rootPath}/themes/images/products/panasonic.jpg"
								alt="Bootshop panasonoc New camera" />
							<div class="caption">
								<h5>Panasonic</h5>
								<h4 style="text-align: center">
									<a class="btn" href="product_details.html"> <i
										class="icon-zoom-in"></i></a> <a class="btn" href="#">Add to <i
										class="icon-shopping-cart"></i></a> <a class="btn btn-primary"
										href="#">$222.00</a>
								</h4>
							</div>
						</div>
						<br />
						<div class="thumbnail">
							<img src="${rootPath}/themes/images/products/kindle.png"
								title="Bootshop New Kindel" alt="Bootshop Kindel">
							<div class="caption">
								<h5>Kindle</h5>
								<h4 style="text-align: center">
									<a class="btn" href="product_details.html"> <i
										class="icon-zoom-in"></i></a> <a class="btn" href="#">Add to <i
										class="icon-shopping-cart"></i></a> <a class="btn btn-primary"
										href="#">$222.00</a>
								</h4>
							</div>
						</div>
						<br />
						<div class="thumbnail">
							<img src="${rootPath}/themes/images/payment_methods.png"
								title="Bootshop Payment Methods" alt="Payments Methods">
							<div class="caption">
								<h5>Payment Methods</h5>
							</div>
						</div>
					</div>
					<!-- Sidebar end=============================================== -->
					<div class="span9">
						<ul class="breadcrumb">
							<li><a href="index.html">Home</a> <span class="divider">/</span></li>
							<li class="active">SHOPPING CART</li>
						</ul>
						<h3>
							购物车 [ <small>${fn:length(requestScope.usersCarList)} 条 </small>]
							<a href="${rootPath }/main.htm" class="btn btn-large pull-right">
								<i class="icon-arrow-left"></i>
								继续购物
							</a>
						</h3>
						<hr class="soft" />
						<!-- 表单提交 -->
						<form action="${rootPath }/head/orders/ordersInsert.htm" method="post" onsubmit="return checkSelectAll('ucid')">
							<table class="table table-bordered">
								<thead>
									<tr>
										<th>
											<input type="checkbox" name="selectAll" id="selectAll" onclick="return selectAllDom('selectAll','ucid')">
										</th>
										<th>序号</th>
										<th>商品图片</th>
										<th>名字</th>
										<th>描述</th>
										<th>数量</th>
										<th>市场价</th>
										<th>折扣价</th>
										<th>总价</th>
									</tr>
								</thead>
								<tbody>
									<!-- 总市场价格 -->
									<c:set value="0" var="totalMarketPrice"/>
									<!-- 总减免 -->
									<c:set value="0" var="totalReduction"/>
									<!-- 总价格 -->
									<c:set value="0" var="totalPrice"/>
									<c:forEach items="${requestScope.usersCarList }" var="usersCar" varStatus="stat">
										<tr>
											<td>
												<input type="checkbox" name="ucid" value="${usersCar.id }">
											</td>
											<td>
												${stat.count }
											</td>
											<td>
												<img width="60" src="${rootPath}/themes/images/products/4.jpg" alt="" />
											</td>
											<td>${usersCar.goods.name }</td>
											<td>
												简介<br />
												规格
											</td>
											<td>
												<%-- <div class="input-append">
													<input class="span1" style="max-width: 34px" placeholder="1"
														name="num" value="${usersCar.num }"
														id="num${stat.count}" size="16" type="text">
													<button class="btn" type="button">
														<i class="icon-minus"></i>
													</button>
													<button class="btn" type="button">
														<i class="icon-plus"></i>
													</button>
													<button class="btn btn-danger" type="button">
														<i class="icon-remove icon-white"></i>
													</button>
												</div> --%>
												${usersCar.num }
											</td>
											<td>Y${usersCar.goods.marketPrice }</td>
											<td>Y${usersCar.goods.price }</td>
											<td>Y${usersCar.goods.price * usersCar.num}</td>
										</tr>
										
										<%--
											int totalSum = 0; 
											int totalCheng = 1 ; 
											for(int i = 0 ; i < 100 ; i ++ )
											{
												totalSum = totalSum + i ; 
												totalCheng = totalCheng * i ;
											}
										 --%>
										<!-- 计算总价格 -->
										<c:set value="${totalMarketPrice + usersCar.goods.marketPrice * usersCar.num}" var="totalMarketPrice"/>
										<c:set value="${totalPrice +  usersCar.goods.price * usersCar.num}" var="totalPrice"/>
										<c:set value="${totalReduction +  (usersCar.goods.marketPrice - usersCar.goods.price ) * usersCar.num}" var="totalReduction"/>
									</c:forEach>
		
									<tr>
										<td colspan="8" style="text-align: right">总价格:</td>
										<td>
											<!-- 所有商品的市场价*数量相加 -->
											Y${totalMarketPrice }
										</td>
									</tr>
									<tr>
										<td colspan="8" style="text-align: right">总减免:</td>
										<td>
											<!-- 每一件(商品的市场价-折扣价) * 数量 -->
											${totalReduction }
										</td>
									</tr>
									<tr>
										<td colspan="8" style="text-align: right">
											<strong>共 (${totalMarketPrice } - ${totalReduction}) =</strong>
										</td>
										<td class="label label-important" style="display: block">
											<strong> ${totalPrice }</strong>
										</td>
									</tr>
									<tr>
										<td colspan="9" style="text-align: left">
											<a href="${rootPath }/cleanAll.htm" onclick="return window.confirm('确认要操作吗?')">清空购物车</a>
										</td>
									</tr>
								</tbody>
							</table>
							<a href="${rootPath }/main.htm" class="btn btn-large">
								<i class="icon-arrow-left"></i> 继续购物
							</a>
							<input type="submit" value="去结算" class="btn btn-large pull-right">
						</form>
					</div>
				</div>
			</div>
		</div>
		<!-- MainBody End ============================= -->
		
		<%@ include file="/common/include/footer.jsp" %>
	</body>
</html>